﻿CREATE PROCEDURE [dbo].[proc_Assets_BF_Audit]
	(
		--@GId uniqueidentifier
		@GId VARCHAR(5000),
		@zcbh VARCHAR(5000),
		@memo_1 NVARCHAR(2000),
		@userid VARCHAR(30),
		@username_1 NVARCHAR(50)
	)
AS
DECLARE @str VARCHAR(5000)
--	Update Assets Set
--		StateId=3
----	 Where GId=@GId
-- Where  '[' +Convert(varchar,id)+']' IN (@GId)
 
 SET @str='Update Assets Set StateId=3 Where  ''['' +Convert(varchar,id)+'']'' IN ('+@GId+')'
 PRINT(@str)
 EXEC (@str)
 
 	--INSERT INTO [zcjl]
  --         ([zcbh]
  --         ,[memo]
  --         ,[lrrq]
  --         ,[userid]
  --         ,[username])
  --   SELECT Anumber            
  --         ,@memo_1
  --         ,GETDATE()
  --         ,@userid
  --         ,@username_1 FROM Assets WHERE  '[' +Convert(varchar,id)+']' IN (@GId)
 
 SET @str='INSERT INTO [zcjl]
           ([zcbh]
           ,[memo]
           ,[lrrq]
           ,[userid]
           ,[username])
     SELECT Anumber            
           ,'''+@memo_1+'''
           ,GETDATE()
           ,'''+@userid+'''
           ,'''+@username_1+''' FROM Assets WHERE  ''['' +Convert(varchar,id)+'']'' IN ('+@GId+')'
 
  PRINT(@str)
EXEC (@str)
 
	RETURN
	
